var express = require('express');
var router = express.Router();
var request = require('request');
var async = require('async');


/* GET home page. */
router.get('/', function(req, res, next) {
    var reqUrl ='http://10.32.18.68:8000/vc-info/';
    request({uri:reqUrl},function(error, response, body){
        if(response.statusCode == 200){
            console.log('success! body:'+body);
            var str = JSON.parse(body);             //把字符串变成字典对象
            console.log('str:'+str);
            res.render('index',{
                title:'主页',
                msg:str
            });
        }else{
            console.log('error res:'+response);
            res.send('error!');
        }
    })
});

module.exports = router;
